package edu.vt.sdm.tcga.navigator;

import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;

public class ContentProvider implements ITreeContentProvider {
private static int i = 0;
	
	
	@Override
	public Object[] getChildren(Object parentElement) {
		if (parentElement instanceof NavigatorRoot) {
			i++;
			return ((NavigatorRoot) parentElement).getParentBeans().toArray();
		} else if (parentElement instanceof ParentBean) {
			return ((ParentBean)parentElement).getChildBeans().toArray();
		}
		return new Object[0];
	}

	@Override
	public Object getParent(Object element) {
		return null;
	}

	@Override
	public boolean hasChildren(Object element) {
		String strType = null;
		
		strType = element.toString();
		return this.getChildren(element).length > 0;

	}

	@Override
	public Object[] getElements(Object inputElement) {
		return this.getChildren(inputElement);

	}

	@Override
	public void dispose() {
		// TODO Auto-generated method stub

	}

	@Override
	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
		// TODO Auto-generated method stub

	}

}
